import { getkechengApi  } from '../../api/xiaoqu'

export default {
    namespaced: true,
    state: () => ({
        list: [],
        listxq:{},
        shouyelist:[]
    }),
    mutations: {
        SET_LIST(state, list) {
            state.list = list
        },
        SET_SHOUYELIST(state, list) {
            state.shouyelist = []
            state.shouyelist = list.map((i)=>{
                return i.home == true
            })
        },
        SET_LISTXQ(state, id) {
            state.listxq = {}
            state.listxq =  state.list.find((i)=>{
               return i._id ==id
            })
        },
    },
    actions: {
        async getkecheng({ commit }, form) {
            const list = await getkechengApi()
            commit('SET_LIST', list)
            commit('SET_SHOUYELIST', list)
        },
       
    },
    getters: {},
    modules: {}
}